//
//  FQOtherQuestionCollectionViewCell.swift
//  SwiftProject
//
//  Created by 董駸 on 2022/9/5.
//

import UIKit

class FQOtherQuestionCollectionViewCell: UICollectionViewCell {
    let titleLb = QMUILabel(font: .rSFont(14), textColor: .color102)
    
    var model : FQHelpCenterListModel! {
        didSet {
            titleLb.text = model.question
        }
    }
    
    var islast : Bool = false {
        didSet {
            if islast {
                layer.cornerRadius = 8
                layer.maskedCorners = [.layerMaxXMaxYCorner, .layerMinXMaxYCorner]
            } else {
                layer.cornerRadius = 0
            }
        }
    }
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        clipsToBounds = true
        backgroundColor = .white
        
        let lineV = UIView()
        lineV.backgroundColor = .color238
        contentView.addSubview(lineV)
        
        lineV.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.right.equalTo(-20)
            make.top.equalToSuperview()
            make.height.equalTo(0.5)
        }
        
        contentView.addSubview(titleLb)
        titleLb.snp.makeConstraints { make in
            make.left.equalTo(20)
            make.centerY.equalToSuperview()
        }
        
        let arrowImage = ArrowButton(arrowSize: CGSize(width: 5, height: 8), arrowColor: .color238, arrowDirection: .right, lineWidth: 1.5)
        arrowImage.isUserInteractionEnabled = false
        contentView.addSubview(arrowImage)
        
        arrowImage.snp.makeConstraints { make in
            make.right.equalTo(-20)
            make.centerY.equalToSuperview()
        }
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
